//
//  CustomerRelevanceItem.swift
//  Employee
//
//  Created by tancheng on 2018/7/24.
//  Copyright © 2018年 remotevillage. All rights reserved.
//

import Foundation

class CustomerRelevanceItem: UIView {
    
    
    
    init(frame: CGRect,data:[String]) {
        super.init(frame: frame)
        setupUI(data)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private  func setupUI(_ data:[String])  {
        
       weak var referView: UIView? = self
        var constant: CGFloat = bounds.width - 20
        for idx in 0..<data.count {
            let lab = UILabel()
            lab.text = data[idx]
            lab.textColor = GlobalConfig.TextDeepColor
            lab.font = GlobalConfig.system16Font
            addSubview(lab)
            lab.snp.makeConstraints({ (make) in
                make.left.equalTo(referView!.snp.right).offset(-constant)
                make.centerY.equalToSuperview()
            })
            referView = lab
            constant = -20
        }
        referView = nil
    }
    
}
